package com.ccb.ic.bbs.provider;

import com.ccb.ic.bbs.service.UserAccountService;
import com.ccb.ic.domain.bbs.User;
import com.ccb.ic.domain.bbs.UserAccount;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class UserProvider {

    @Autowired
    UserAccountService userAccountService;

    public User getUser(String token) {
        User user = new User();
        user.setId(101L);
        user.setName("kaizone");
        return user;
    }

    public UserAccount getUserAccount(User user) {
        if (user == null) return null;
        return getUserAccount(user.getId());
    }

    public UserAccount getUserAccount(long userId) {
        return userAccountService.selectUserAccountByUserId(userId);
    }
}
